﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using GPSTrackingClientsWebsiteManager.GPSTrackingWebserviceBL;

namespace GPSTrackingClientsWebsiteManager.Espanol.Pages
{
    public partial class GoogleMap : Telerik.Web.UI.RadAjaxPage
    {
        [System.Web.Services.WebMethod]
        public static ArrayOfString wsLoadRouteHistory(string imei, DateTime date)
        {
            try
            {
                return new GPSTrackingWSBLSoapClient().wsLoadRouteHistory(imei, date);
            }
            catch (Exception e) {
                throw e;
            }
        }

        [System.Web.Services.WebMethod]
        public static string wsInsertGeoFence(string imei, string description, ArrayOfString latitudePolygonoList, ArrayOfString longitudePolygonoList)
        {
            try
            {
                return new GPSTrackingWSBLSoapClient().wsInsertGeoFence(imei, description, latitudePolygonoList, longitudePolygonoList);
            }

            catch (Exception e)
            {
                throw e;
            }
        }

        [System.Web.Services.WebMethod]
        public static string wsInsertCustomer(string name, Int64 customerGroupID, float latitude, float longitude)
        {
            try
            {
                controller myContol = new controller();
                return myContol.insertCustomer(name, customerGroupID, latitude, longitude);
            }

            catch (Exception e)
            {
                throw e;
            }
        }

        [System.Web.Services.WebMethod]
        public static void wsDeleteCustomer(int customerID, Int64 customerGroupID)
        {
            try
            {
                controller myContol = new controller();
                myContol.deleteCustomer(customerID, customerGroupID);
            }

            catch (Exception e)
            {
                throw e;
            }
        }

        [System.Web.Services.WebMethod]
        public static string wsGetCustomersByUsernameAndCustomerGroupID(string username, Int64 customerGroupID)
        {
            try
            {
                controller myContol = new controller();
                return myContol.GetCustomersByUsernameAndCustomerGroupID(username, customerGroupID);
            }

            catch (Exception e)
            {
                throw e;
            }
        }

        [System.Web.Services.WebMethod]
        public static string wsGetCustomersGroupsByUsername(string username)
        {
            try
            {
                controller myContol = new controller();
                return myContol.GetCustomersGroupsByUsername(username);
            }

            catch (Exception e)
            {
                throw e;
            }
        }

        [System.Web.Services.WebMethod]
        public static string wsUpdateGeoFenceByGeoFenceID(string username, int geoFenceID, string description, string imei, ArrayOfString latitudePolygonoList, ArrayOfString longitudePolygonoList)
        {
            try
            {
                return new GPSTrackingWSBLSoapClient().wsUpdateGeoFenceByGeoFenceID(username, geoFenceID, description, imei, latitudePolygonoList, longitudePolygonoList);
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        [System.Web.Services.WebMethod]
        public static string wsGetGroupsTrackDataLastLocationByUser(string username)
        {
            try
            {
                return new GPSTrackingWSBLSoapClient().wsGetGroupsTrackDataLastLocationByUser(username);
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        [System.Web.Services.WebMethod]
        public static string wsGetImeiTrackDataLastLocationByUser(string username)
        {
            try
            {
                return new GPSTrackingWSBLSoapClient().wsGetImeiTrackDataLastLocationByUser(username);
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        [System.Web.Services.WebMethod]
        public static void wsDeleteGeoFence(int geoFenceID, string imei)
        {
            try
            {
                new GPSTrackingWSBLSoapClient().wsDeleteGeoFence(geoFenceID, imei);
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        [System.Web.Services.WebMethod]
        public static string wsGetAllGeoFenceDetails(string username)
        {
            try
            {
                return new GPSTrackingWSBLSoapClient().wsGetAllGeoFenceDetails(username);
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        [System.Web.Services.WebMethod]
        public static string wsGetUsersByAdmin(string username)
        {
            try
            {
                controller myContol = new controller();
                return myContol.wsGetCustomerByAdmin(username);
            }

            catch (Exception e)
            {
                throw e;
            }
        }

        [System.Web.Services.WebMethod]
        public static string wsGetAllCustomerByUser(string username, int orderColumn)
        {
            try
            {
                controller myContol = new controller();
                return myContol.wsGetAllCustomerByUser(username, orderColumn);
            }

            catch (Exception e)
            {
                throw e;
            }
        }
        
        [System.Web.Services.WebMethod]
        public static string wsGetImeiByUser(string username)
        {
            try
            {
                controller myContol = new controller();
                return myContol.wsGetImeiByUser(username);
            }

            catch (Exception e)
            {
                throw e;
            }
        }

       /* [System.Web.Services.WebMethod]
        public static string GetLastLocationByImei(string Imei)
        {
            try
            {
                return DateTime.Now.ToShortDateString(); //GPSTrackingServerDB.Data.DataRepository.TrackDataLastLocationProvider.GetByImei(Imei).ToString();                
            }
            catch (Exception e)
            {
                throw e;
            }
        }*/
    }
}